<?php
define( 'BASE_IMPORT_DIR',dirname(__FILE__) );

/**
 +----------------------------------------------------------
 * spip_make_dir
 +---------------------------------------------------------- 
 * @param string $dir  directory to create
 +----------------------------------------------------------
 * @return boolen
 +----------------------------------------------------------
 * create by Ken Chen. 20090309
 +----------------------------------------------------------
 */
function spip_make_dir( $dir,$mode = '0775' )
{
	$dirs = explode("/", $dir);
	
	$str_dir = "";
	for($i=0; $i<count($dirs); $i++)
	{		
		if( $i == 0 )
			$str_dir .= $dirs[$i];
		else $str_dir .= "/{$dirs[$i]}";
		if(!is_dir ($str_dir)){
			if( !empty( $str_dir ) ){
				mkdir ($str_dir, $mode);
				chmod( $str_dir, $mode );
			}
		}
	}
	
	return ;
}

//import magento framework
require dirname(__FILE__) . '/../app/Mage.php';
Mage::app();
Mage::register('isSecureArea', true, true);

include(dirname(__FILE__)."/config.inc.php");
include(dirname(__FILE__)."/Lib/ImportBase.class.php");
include(dirname(__FILE__)."/Lib/Importer.class.php");
include(dirname(__FILE__)."/Lib/CategoryImport.class.php");
include(dirname(__FILE__)."/Lib/ProductImport.class.php");
include(dirname(__FILE__)."/Lib/ProductImagesImport.class.php");
include(dirname(__FILE__)."/Lib/CustomerImport.class.php");
include(dirname(__FILE__)."/Lib/ProductUpdateSKU.class.php");
include(dirname(__FILE__)."/Lib/ProductUpdateTax.class.php");
include(dirname(__FILE__)."/Lib/OrderImport.class.php");

$import = new Importer;
$import->add_importer( new CategoryImport );
$import->add_importer( new ProductImport );
//$import->add_importer( new ProductImagesImport );
$import->add_importer( new CustomerImport );
//$import->add_importer( new ProductUpdateSKU );
//$import->add_importer( new ProductUpdateTax );
$import->add_importer( new OrderImport );

$import->import();